
const models = {
  'sale.order': {
    extend: BaseClass => {
      class cls extends BaseClass {
      }

      cls.action_invoice_create = async (id, fields={}, grouped=false, final=false, kwargs={}) => {
        return cls.call_as_write_read({
          method: 'action_invoice_create',
          args: [ id, grouped, final ],
          kwargs,
        }, fields );
      }

      cls.action_draft = async (id, fields={}, kwargs={}) => {
        return cls.call_as_write_read({
          method: 'action_draft',
          args: [ id ],
          kwargs,
        }, fields );
      }

      cls.action_cancel = async (id, fields={}, kwargs={}) => {
        return cls.call_as_write_read({
          method: 'action_cancel',
          args: [ id ],
          kwargs,
        }, fields );
      }

      cls.action_done = async (id, fields={}, kwargs={}) => {
        return cls.call_as_write_read({
          method: 'action_done',
          args: [ id ],
          kwargs,
        }, fields );
      }

      cls.action_unlock = async (id, fields={}, kwargs={}) => {
        return cls.call_as_write_read({
          method: 'action_unlock',
          args: [ id ],
          kwargs,
        }, fields );
      }

      cls.action_confirm = async (id, fields={}, kwargs={}) => {
        return cls.call_as_write_read({
          method: 'action_confirm',
          args: [ id ],
          kwargs,
        }, fields );
      }
      return cls;
    },

  },

//    'sale.order.line': {},
};


export default {
  name: 'sale',
  depends: [ 'sales_team', 'payment' ],
  models,
};

